In this tutorial, we will learn:
plotly to display graphsplotly and ggplotIn rethomics, the graphs aere generated as ggplot objects. These can be exported as pdf which is great for publication-quality graph. However, sometimes, we want some degree of interactivenes with the figures, so we can zoom, exclude some data etc. The packages plotly can take pretty much any ggplot object and make it interactive.
install.packages("plotly")
library("plotly")
First, lets make an ethogram as a static figure see here:
data(sleep_sexual_dimorphism)
dt <- sleep_sexual_dimorphism
pl <- ethogramPlot(moving, dt, sex, error_bar="sem")
pl
This pl object is a static figure, so is is just displayed as an image.
Now by just using ggplotly() function, we can make the following:
ggplotly(pl)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
A few useful thing we can do here:
xy valuesFor more info, have a look at the plotly package itself.